 <h1 class="page-header">操作</h1>
<ol class="breadcrumb">
  <li><a data-toggle="modal" data-target="#addUser">增加商品</a></li>
</ol>
<h1 class="page-header">管理 <span class="badge">2</span></h1>
<div class="table-responsive">
  <table class="table table-striped table-hover">
    <thead>
      <tr>
        <th><span class="glyphicon glyphicon-th-large"></span> <span class="visible-lg">选择</span></th>
        <th><span class="th-large"></span> <span class="visible-lg">商品id</span></th>
        <th><span class="user"></span> <span class="visible-lg">原价</span></th>
        <th><span class="user"></span> <span class="visible-lg">现价</span></th>
        <th><span class="user"></span> <span class="visible-lg">名称</span></th>
        <th><span class="user"></span> <span class="visible-lg">图片</span></th>
        <th><span class="user"></span> <span class="visible-lg">类型</span></th>
        <th><span class="user"></span> <span class="visible-lg">物品类型</span></th>
        <th><span class="pencil"></span> <span class="visible-lg">操作</span></th>
      </tr>
    </thead>
<!--     "id":8,"introduce":null,"old_price":13000,"price":6825,"good_name":"Apple MacBook Pro 13.3英寸笔记本电脑","cover":"http:\\/\\/www.kimwear.cn\\/upload\\/sys\\/image\\/proimg\\/8.jpg","type":1,"is_product_type":"实物" -->
    <tbody>
      <%for(var i = 0;i<data.length;i++){%>
      <tr>
       <td><input type="checkbox" class="input-control" name="checkbox[]" value="<%=data[i].id%>" /></td>
        <td class="article-title"><%=data[i].id %></td>
        <td class="hidden-sm"><%=data[i].old_price %></td>
        <td class="hidden-sm"><%=data[i].price %></td>
        <td class="hidden-sm"><%=data[i].good_name%></td>
        <td class="hidden-sm"><%=data[i].cover%></td>
        <td class="hidden-sm"><%=data[i].type%></td>
        <td class="hidden-sm"><%=data[i].is_product_type%></td>
       <td class="hidden-sm"><a href="/admin/shop/update/<%=data[i].id %>">修改</a> <a rel="<%=data[i].id %>">删除</a></td>
      </tr>
      <% }%>
    </tbody>
  </table>
</div>
   <footer class="message_footer">
    <nav>
      <div class="btn-toolbar operation" role="toolbar">
        <div class="btn-group" role="group"> <a class="btn btn-default" onClick="select()">全选</a> <a class="btn btn-default" onClick="reverse()">反选</a> <a class="btn btn-default" onClick="noselect()">不选</a> </div>
        <div class="btn-group" role="group">
          <button type="submit" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="删除全部选中" name="checkbox_delete">删除</button>
        </div>
   <footer />
<script>
//是否确认删除
$(function(){   
  $("#main table tbody tr td a").click(function(){
    var name = $(this);
    var id = name.attr("rel"); //对应id  
    if (event.srcElement.outerText === "删除") 
    {
      if(window.confirm("此操作不可逆，是否确认？"))
      {
        $.ajax({
          type: "POST",
          url: "/admin/article/delete",
          data: "id=" + id,
          cache: false, //不缓存此页面   
          success: function (data) {
            window.location.reload();
          }
        });
      };
    };
  });   
});
</script>
   
